using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;

public class UICtl : MonoBehaviour
{
    private UIDocument _document;

    private VisualElement root;

    private VisualElement hp_bar;
    private Label hp_text;
    private VisualElement buff_container;

    private float fullWidth;
    // Start is called before the first frame update
    void Start()
    {
        _document = GetComponent<UIDocument>();
        root = _document.rootVisualElement;
        init();
    }

    void init()
    {
        hp_bar = root.Q<VisualElement>(classes: "hp_bar");
        hp_text = root.Q<Label>(classes: "hp_text");
        buff_container = root.Q<Label>(classes: "buff_container");
        fullWidth = hp_bar.parent.style.width.value.value;
        //TODO 设置百分比
        hp_bar.style.width = fullWidth;
        hp_text.text = "100/100";
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
